from django.conf.urls.defaults import *
from mysite.blog.models import *
from django.contrib.auth.models import *
from mysite.feeds import *
from django.contrib.comments.feeds import *
blog_dict = {
    'queryset': Blog.objects.all(),
    'date_field': 'pub_date',
    }

blog_date_dict = {
    'queryset': Blog.objects.all(),
    'date_field': 'pub_date',
    'template_object_name': 'blog',
    }
tag_dict = {
    'queryset': Tag.objects.all(),
    'allow_empty': 'true',
    }
author_dict = {
    'queryset': Author.objects.all(),
    'template_object_name': 'author',
    }
feeds = {
    'blog': BlogFeed,
    }

urlpatterns = patterns('',
#Inne
    (r'^admin/', include('django.contrib.admin.urls')),
    (r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}),
)

urlpatterns += patterns('django.views.generic.date_based',
#Blog
    (r'^blog/(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>[-\w]+)/$', 'object_detail', dict(blog_date_dict, slug_field='slug')),
    (r'^blog/(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/$','archive_day', blog_date_dict),
    (r'^blog/(?P<year>\d{4})/(?P<month>[a-z]{3})/$','archive_month', blog_date_dict),
    (r'^blog/(?P<year>\d{4})/$','archive_year', blog_date_dict),
    (r'^blog/$','archive_index', blog_dict)
)
urlpatterns += patterns ('mysite.blog.views',
(r'^blog/(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>[-\w]+)/mark/$','mark'),
             )
                         
                       
urlpatterns += patterns ('django.views.generic.list_detail',
#Tag
    (r'^blog/tag/$', 'object_list', dict(tag_dict, template_name="tag/tag_list.html")),
#Autor
    (r'^blog/author/$','object_list', dict(author_dict, template_name="author/author_list.html")),
    (r'^blog/author/(?P<slug>[-\w]+)/$','object_detail',dict(author_dict, slug_field="slug",template_name="author/author_detail.html")),
                  )
